//
//  WmcEditBrandToolCell.swift
//  YPWatermarkCamera
//
//  Created by 赵新 on 2022/6/9.
//

import UIKit

extension WmcEditBrandToolCell {
    /// 事物类型
    enum ItemType {
        /// 品牌选择
        case brandLibrary
        /// 相册选择
        case albumSelect
        /// 裁剪
        case tailor
        /// 改变位置
        case changeLocation
        /// 去底色
        case removeBackgroundColor
        /// 缩放
        case scale
        /// 透明度
        case alpha

        struct Info {
            var title: String
            var iconImage: UIImage
//            var isSelect: Bool = false
        }

        var info: Info {
            switch self {
            case .brandLibrary: return .init(title: "品牌选择", iconImage: "edit_brand_brand_select".wmc_image)
            case .albumSelect: return .init(title: "从相册选择", iconImage: "edit_brand_album_select".wmc_image)
            case .tailor: return .init(title: "裁剪", iconImage: "edit_brand_cut".wmc_image)
            case .changeLocation: return .init(title: "换位置", iconImage: "edit_brand_change_position".wmc_image)
            case .removeBackgroundColor: return .init(title: "去底色", iconImage: "edit_brand_remove_background_color".wmc_image)
            case .scale: return .init(title: "调大小", iconImage: "edit_brand_scale".wmc_image)
            case .alpha: return .init(title: "透明度", iconImage: "edit_brand_alpha".wmc_image)
            }
        }
    }
}

// MARK: - [WmcEditBrandToolCell]

class WmcEditBrandToolCell: WmcBaseCollectionCell {
    
    lazy var imageBackgroudView: UIView = {
        let view = UIView()
        view.backgroundColor = .wmc_grayH19_F5F5F5
        view.layer.cornerRadius = 8
        view.layer.masksToBounds = true
        return view
    }()
    
    override func makeUI() {
        addSubview(imageBackgroudView)
        imageBackgroudView.snp.makeConstraints { make in
            make.top.left.right.equalToSuperview()
            make.bottom.equalTo(-30)
        }
        
        imageBackgroudView.addSubview(imageView)
        imageView.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.size.equalTo(32)
        }
        
        titleLabel.font = 14.wmc_font
        titleLabel.textColor = .wmc_grayH2_323233
        titleLabel.textAlignment = .center
        addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.top.equalTo(imageBackgroudView.snp.bottom)
            make.left.right.bottom.equalToSuperview()
        }
    }
    
    func configType(_ type: WmcEditBrandToolCell.ItemType) {
        imageView.image = type.info.iconImage
        titleLabel.text = type.info.title
    }
    
}
